fix: escape fallback raw-content text nodes#32
Open
SkyZeroZx wants to merge 1 commit into
Open
Conversation
alan-agius4
requested changes
Jun 23, 2026
alan-agius4
left a comment
There was a problem hiding this comment.
The tests indicate this fix introduces a regression with comments. For instance, <noscript><!-- something --></noscript> becomes escaped <noscript><!-- something --></noscript>. Although not dangerous, it changes the semantics by rendering a comment as active text which is incorrect.
c1781e6 to
9243756
Compare
Escape text nodes in iframe, noembed, noscript, and noframes during HTML serialization instead of emitting attacker-controlled bytes as raw markup. These fallback raw-content elements are inert when parsed directly by a browser, but SSR post-processing can reparse serialized HTML without preserving raw-content parser state. Escaping their text nodes prevents ancestor-closing payloads from being emitted as executable markup while preserving raw serialization for script, style, xmp, and plaintext.
9243756 to
f56a381
Compare
Author
@alan-agius4 Updated, regression tests were also added for the case of comments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Escape text nodes in
iframe,noembed,noscript, andnoframesduring HTML serialization instead of emitting attacker-controlled bytes as raw markup.These fallback raw-content elements are inert when parsed directly by a browser, but SSR post-processing can reparse serialized HTML without preserving raw-content parser state. Escaping their text nodes prevents ancestor-closing payloads from being emitted as executable markup while preserving raw serialization for script, style, xmp, and plaintext.
More context
https://issuetracker.google.com/u/1/issues/525899990( marked as duplicated , due it was marked as a duplicate of my first report )@alan-agius4 Could you please check it?
EDIT : Traceability is now available at https://issuetracker.google.com/u/1/issues/525782033